<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="renderer" content="webkit">
    <link rel="stylesheet" href="../mdui/css/mdui.min.css">
    <script defer src="../mdui/js/mdui.min.js"></script>
    <script src="../js/axios.min.js"></script>
    <script src="../js/qs.min.js"></script>
    <script src="../js/common.js"></script>
    <script src="../js/vue.js"></script>

</head>
<body class="mdui-theme-primary-indigo mdui-theme-accent-green">


<div class="mdui-container-fluid" id="app">
    <h1 class="mdui-text-color-theme">审批</h1>


    <div style="margin-bottom: 9px;">
        <a href=" add.html
    " class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme-accent">申请</a>
    </div>
    <table class="mdui-table mdui-table-hoverable">
        <thead>
        <tr>
            <th>编号</th>
            <th>标题</th>
            <th>提交人</th>
            <th>提交时间</th>
            <th>审批状态</th>
            <th>回复</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="(task,index) in tasks">
            <td>{{task.id}}</td>
            <td>{{task.title }}</td>
            <td>{{task.useriinfo.name}}</td>
            <td>{{task.createTime}}</td>
            <td>{{task.status | statusFmt}}</td>
            <td>{{task.reply }}</td>
            <td>
                <button @click="doApprove(task.id)" class="mdui-btn mdui-btn-icon ">
                    <i class="mdui-icon material-icons">edit</i></button>
            </td>
        </tr>
        </tbody>
    </table>


</div>

<script>
    let vm = new Vue({
        el: "#app",
        data: {
            useriinfo: {
                name: ''
            },
            tasks: []
        },
        created() {
            this.findList();
        },

        filters: {
            statusFmt(val) {
                if (val == 1) {
                    return "待审批"
                } else if (val == 2) {
                    return "未通过"
                } else {
                    return "已通过"
                }
            }
        },
        methods: {
            doApprove(taskId) {
                // window.location.href = "aprove_edit.html"
                navigateTo("/task/aprove_edit.html?taskId=" + taskId)

            },
            findList() {//查看自己要审批的任务
                let _this = this
                axios.get("/task/myApproveList")
                    .then(function (res) {
                        _this.tasks = res.data;
                    })
            }
        }
    });

</script>


</body>
</html>